/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.googlecode.jsimplemarket.wicket.pages;

import com.googlecode.jsimplemarket.model.SpatiuComercial;
import com.googlecode.jsimplemarket.wicket.components.grid.ActionButton;
import com.googlecode.jsimplemarket.wicket.components.grid.ActionButtons;
import com.googlecode.jsimplemarket.wicket.components.grid.ColumnModel;
import com.googlecode.jsimplemarket.wicket.components.grid.DefaultGridAction;
import com.googlecode.jsimplemarket.wicket.components.grid.Grid;
import com.googlecode.jsimplemarket.wicket.components.grid.PageParameters;
import java.util.Arrays;
import java.util.List;
import org.apache.wicket.spring.injection.annot.SpringBean;

/**
 *
 * @author Alexandru.Codescu
 */
public class SpatiuViewPage extends DefaultViewPage {
    @SpringBean(name = "defaultGridAction")
    private DefaultGridAction<SpatiuComercial> gridAction;
    
    public SpatiuViewPage() {
        ColumnModel[] grids = {
            new ColumnModel("Cod", "cod", String.class),
            new ColumnModel("Stare", "stareSpatiuComercial.denumire", String.class),
            new ColumnModel("Tip", "tipSpatiuComercial.denumire", String.class),
        };
        List<ColumnModel> columns = Arrays.asList(grids);
        ActionButton actionButton = new ActionButton(new PageParameters(SpatiuEditPage.class));
        ActionButtons actionButtons = new ActionButtons(actionButton);
        Grid<SpatiuComercial> dataGrid = new Grid<SpatiuComercial>("grid", columns, SpatiuComercial.class, gridAction, actionButtons);
        add(dataGrid);
    }
}
